<meta name="keywords" content="" />
<meta name="description" content="" />
<meta http-equiv="content-type" content="text/html; charset=utf-8" />
<?php if (isset($html_title)):?>
<title><?php echo $html_title . SITE_TITLE_CHS ?></title>
<?php elseif (url_contains('backend')):?>
<title><?php echo '后台管理' . SITE_TITLE_CHS ?></title>
<?php endif;?>
<link type="text/css" href="<?php echo MAIN_CSS ?>style.css" media="screen" rel="stylesheet" />
<link type="text/css" href="<?php echo PLUGIN_HEADER_NAV_BUTTON_CSS ?>" rel="stylesheet" />
<link type="text/css" href="<?php echo PLUGIN_HEADER_NAV_SEARCH_CSS ?>" rel="stylesheet" />
<link type="text/css" href="<?php echo PLUGIN_UI_CSS ?>" rel="stylesheet" />
<script type="text/javascript" src="<?php echo PLUGIN_JQUERY ?>"></script>
<script type="text/javascript" src="<?php echo PLUGIN_HEADER_NAV_SEARCH_JS ?>"></script>
<script type="text/javascript" src="<?php echo PLUGIN_HEADER_NAV_TIP_JS ?>"></script>
<script type="text/javascript" src="<?php echo PLUGIN_UI_JS ?>"></script>
<script type='text/javascript' src="<?php echo PLUGIN_SPIN_MAIN_JS ?>" ></script>
<script type='text/javascript' src="<?php echo PLUGIN_SPIN_CUSTOM_JS ?>" ></script>

<?php if (url_contains("frontend") OR $_SERVER['REQUEST_URI'] == "/" OR $_SERVER['REQUEST_URI'] == "/index.php"):?>
	<link type="text/css" href="<?php echo MAIN_CSS ?>frontend_style.css" rel="stylesheet" />
	
	<?php if (url_contains(array("register", "login"))):?>
	<link type="text/css" href="<?php echo PLUGIN_VALIDATES_CSS ?>" rel="stylesheet" />
	<?php endif;?>
	
	<?php if (empty($_SESSION)):?>
	<link type="text/css" href="<?php echo PLUGIN_HEADER_NAV_LOGIN_CSS ?>" rel="stylesheet" />
	<?php endif;?>
	
	<?php //if (url_contains("news_detail")):?>
	<link type="text/css" href="<?php echo MAIN_CSS ?>news_and_announcement.css" rel="stylesheet" />
	<?php //endif;?>
	
	<?php if (url_contains("society/home") OR $_SERVER['REQUEST_URI'] == "/" OR $_SERVER['REQUEST_URI'] == "/index.php"):?>
	<link type="text/css" href="<?php echo PLUGIN_SLIDES_THEME_CSS ?>" rel="stylesheet" />
	<link type="text/css" href="<?php echo PLUGIN_SLIDES_MAIN_CSS ?>" rel="stylesheet" />
	<?php endif;?>
	
	<?php if (url_contains(array("register", "login"))):?>
	<?php if (url_contains("register")):?>
	<script type="text/javascript" src="<?php echo PLUGIN_VALIDATES_JS ?>jquery.validationEngine_register.js"></script>
	<script type="text/javascript" src="<?php echo MAIN_JS ?>register.js"></script>
	<script type="text/javascript" src="<?php echo MAIN_JS ?>common_data.js"></script>
	<?php else :?>
	<script type="text/javascript" src="<?php echo PLUGIN_VALIDATES_JS ?>jquery.validationEngine_common.js"></script>
	<?php endif;?>
	<script type="text/javascript" src="<?php echo PLUGIN_VALIDATES_CORE_JS ?>"></script>
	<?php endif;?>
	
	<?php if (empty($_SESSION)):?>
	<script type="text/javascript" src="<?php echo PLUGIN_HEADER_NAV_LOGIN_JS ?>"></script>
	<?php endif;?>
	
	<?php if ($this->uri->segment(3) == "news_detail" && $this->uri->segment(5) != ""):?>
	<script type="text/javascript" src="<?php echo PLUGIN_HIGHLIGHT ?>"></script>
	<?php endif;?>
	
	<?php if (url_contains("society/home") OR $_SERVER['REQUEST_URI'] == "/" OR $_SERVER['REQUEST_URI'] == "/index.php"):?>
	<script type="text/javascript" src="<?php echo PLUGIN_SLIDES_JS ?>"></script>
	<?php endif;?>

	<script type="text/javascript" src="<?php echo MAIN_JS ?>tool.js"></script>
	
	<script>
	$(document).ready(function() {
		$("button").button();
		$(".anchor_button").button();
		$("#radio").buttonset();

		<?php if (empty($_SESSION)):?>
		//deal with auth cookies
		var allcookies = document.cookie;
		var pos = allcookies.indexOf("<?php echo sha1(COOKIE_USER_AUTH) . '='?>");
		if (pos != -1) {
			$.post('/index.php/frontend/ajax_login/login_by_cookie', function(data) {
				if (data == 'succeed') {
					location.replace(location.href);
				};
			});
		}
		<?php endif;?>
		
		<?php if (url_contains("register")):?>
		$("#content").append(
			"<div id='register_confirm_dialog' title='请仔细阅读用户注册说明'>" +
			"<p style='text-align:center; font-size:20px; font-weight:bold; color: #f60;'><?php echo SITE_NAME_FULL?>网站 - 用户注册说明</p>" +
			"<span style='font-size:20px; font-weight:bold; color: #f60;'><?php echo SOCIETY_CHS?>注册说明</span>" +
			"<p><?php echo SOCIETY_REGISTER_README?></p>" +
			"<span style='font-size:20px; font-weight:bold; color: #f60;'><?php echo ASSOCIATION_CHS?>注册说明</span>" +
			"<p><?php echo ASSOCIATION_REGISTER_README?></p>" +
			"</div>"
		);
		
		$("#dialog:ui-dialog").dialog("destroy");
		
		$("#register_confirm_dialog").dialog({
			resizable: false,
			draggable: false,
			width: 800,
			height: 480,//580
			modal: true,
			buttons: {
				"同意": function() {
					$( this ).dialog( "close" );
				},
				"不同意": function() {
					history.back(-1);
				}
			}
		});
		$("a.ui-dialog-titlebar-close").hide();
	
		var defaultDate = <?php echo date("Y", time()) - 20?> + "年01月01日";
		$("#datepicker").datepicker({
			changeMonth: true,
			changeYear: true,
			defaultDate: defaultDate,
			//yearRange: "1892:2012",
			dateFormat: 'yy年mm月dd日',
			dayNamesMin: ['日', '一', '二', '三', '四', '五', '六'],
			monthNamesShort: ['一月','二月','三月','四月','五月','六月','七月','八月','九月','十月','十一月','十二月'] 
		});
	
		jQuery("#register_form").validationEngine();
		<?php endif;?>
	
		<?php if (url_contains("login")):?>
		jQuery("#login_form").validationEngine();
		<?php endif;?>
	
		<?php if (empty($_SESSION)):?>
		//登录框
		$(".signin").click(function(e) {
			e.preventDefault();
			$("fieldset#signin_menu").toggle();
			$(".signin").toggleClass("menu-open");
		});
	
		$("fieldset#signin_menu").mouseup(function() {
			return false;
		});
		$(document).mouseup(function(e) {
			if($(e.target).parent("a.signin").length==0) {
				$(".signin").removeClass("menu-open");
				$("fieldset#signin_menu").hide();
				
				$("#signin .username").css({ "display": "inline" });
				$("#signin .email").css({ "display": "none" });
				$('#login_msg').empty();
				$('#username').val(document.getElementById("username").defaultValue);
				$('#email').val(document.getElementById("email").defaultValue);
				$('#password').val("");
				document.getElementById("remember").checked = false;
			}
		});
		$('.login_mode a').tipsy({gravity: 'w'});
		$('#regist_account_link').tipsy({gravity: 'w'});
		<?php endif;?>
	
		//搜索框
		$(".search").click(function(e) {
			e.preventDefault();
			$("fieldset#search_menu").toggle();
			$(".search").toggleClass("menu-open");
		});
		
		$("fieldset#search_menu").mouseup(function() {
			return false;
		});
		$(document).mouseup(function(e) {
			if($(e.target).parent("a.search").length==0) {
				$(".search").removeClass("menu-open");
				$("fieldset#search_menu").hide();
			}
		});
		$('#advanced_search_link').tipsy({gravity: 'w'});
	
		<?php if (url_contains("society/home")):?>
		//社团主页空间访问计数器
		$(function() {
			var society_id = window.location.href.split('/') [window.location.href.split('/').length - 1];
			$.post('<?php echo BASE_URL ?>index.php/frontend/society/ajax_update_home_view_count', {society_id: society_id});
		});
		<?php endif;?>
	
		<?php if ($this->uri->segment(3) == "news_detail"):?>
		<?php if ($this->uri->segment(5) != ''): ?>
		//全文检索新闻加高亮
		$(function() {
			var keywords_str = window.location.href.split('/') [8];
			var keywords_array = decodeURI(keywords_str).split('_');
			for (var i = 0; i < keywords_array.length; i++) {
				$(".news.preview #title, .news.preview #description, .news.preview #contents").highlight(keywords_array[i]);
			}
		});
		<?php endif;?>
		//新闻浏览计数器
		$(function() {
			var temp_news_id = window.location.href.split('/') [window.location.href.split('/').length - 1];
			//alert(temp_news_id);
			var news_id = temp_news_id.replace(/\D/g, "");
			//alert(news_id);
			<?php if ($this->uri->segment(2) == "society"):?>
			$.post('<?php echo base_url()?>index.php/frontend/society/ajax_update_news_view_count', {news_id: news_id});
			<?php else:?>
			$.post('<?php echo base_url()?>index.php/frontend/association/ajax_update_news_view_count', {news_id: news_id});
			<?php endif;?>
		});
		
		//新闻图片样式
		$(".news.preview #contents img").wrapAll("<div class='pic_wrapper'></div>");
		<?php endif;?>
	});
	</script>
<?php elseif (url_contains("backend")):?>
	<link type="text/css" href="<?php echo MAIN_CSS ?>backend_style.css" rel="stylesheet" />
	
	<?php if (url_contains(array("news", "announcement"))):?>
	<link type="text/css" href="<?php echo MAIN_CSS ?>news_and_announcement.css" rel="stylesheet" />
	<?php endif;?>
	
	<?php if (url_contains(array("update_info", "save_new_info", "show_change_password", "show_change_email", "edit"))):?>
	<link type="text/css" href="<?php echo PLUGIN_VALIDATES_CSS ?>" rel="stylesheet" />
	<?php endif;?>
	
	<?php if (url_contains("upload_init")):?>
	<link type="text/css" href="<?php echo PLUGIN_LIGHTBOX_CSS ?>" rel="stylesheet" />
	<link type="text/css" href="<?php echo PLUGIN_CROP_CSS ?>" rel="stylesheet" />
	<?php endif;?>
	
	<?php if (url_contains(array("update_info", "save_new_info", "show_change_password", "show_change_email", "edit"))):?>
		<script type="text/javascript" src="<?php echo PLUGIN_VALIDATES_JS ?>jquery.validationEngine_<?php if (!strripos($this->uri->segment(2), "_")) {echo $this->uri->segment(2);} else { echo 'common';}?>.js"></script>
		<script type="text/javascript" src="<?php echo PLUGIN_VALIDATES_CORE_JS ?>"></script>
		
		<?php if (url_contains(array("update_info", "save_new_info", "edit"))):?>
		<script type="text/javascript" src="<?php echo PLUGIN_CKEDITOR_JS ?>"></script>
		<script type="text/javascript" src="<?php echo PLUGIN_CKFINDER_JS ?>"></script>
		<?php endif;?>
	
	<?php endif;?>
	
	<?php if (url_contains("upload_init")):?>
	<script type="text/javascript" src="<?php echo PLUGIN_LIGHTBOX_JS ?>"></script>
	<script type="text/javascript" src="<?php echo PLUGIN_CROP_JS ?>"></script>
	<?php endif;?>
	
	<script type="text/javascript" src="<?php echo MAIN_JS ?>common_data.js"></script>
	
	<script type="text/javascript" src="<?php echo MAIN_JS ?><?php echo $this->common_data->_get_user_category_eng_by_ucid($_SESSION['ucid'])?>_tool.js"></script>
	<script type="text/javascript" src="<?php echo MAIN_JS ?>tool.js"></script>
	
	<script>
	$(document).ready(function() {
		$("button").button();
		$(".anchor_button").button();
		$("#radio").buttonset();
		$(".accordion").accordion({
			collapsible: true,
			autoHeight: true,
			navigation: true
		});
		
		<?php if (url_contains(array("update_info", "save_new_info"))):?>
		var defaultDate = "<?php echo date("Y", time()) - 20?>年01月01日";
		$("#datepicker").datepicker({
			changeMonth: true,
			changeYear: true,
			defaultDate: defaultDate,
			dateFormat: 'yy年mm月dd日',
			dayNamesMin: ['日', '一', '二', '三', '四', '五', '六'],
			monthNamesShort: ['一月','二月','三月','四月','五月','六月','七月','八月','九月','十月','十一月','十二月']
		});
		$("#update_info_form").validationEngine();
		<?php elseif (url_contains("show_change_password")):?>
		$("#change_password_form").validationEngine();
		<?php elseif (url_contains("show_change_email")):?>
		$("#change_email_form").validationEngine();
		<?php elseif (url_contains("edit")):?>
		$("#edit_form").validationEngine({
			promptPosition: "centerRight"
		});
		
		<?php endif;?>
	
		<?php if (url_contains("upload_init")):?>
		//引入colorbox所需文件开始
		$("a[rel='cb_img']").colorbox({transition:"none", width:"75%", height:"75%"});
		$("#click").click(function(){ 
			$('#click').css({"background-color":"#f00", "color":"#fff", "cursor":"inherit"}).text("Open this window again and this message will still be here.");
			return false;
		});

		<?php if (1 == 0):?>
		//图片切割配置
		jQuery(function($){

			// Create variables (in this scope) to hold the API and image size
			var jcrop_api, boundx, boundy;
		      
			$('#target').Jcrop({
				minSize: [48,48],
				setSelect: [0,0,190,190],
		        onChange: updatePreview,
		        onSelect: updatePreview,
				onSelect: updateCoords,
		        aspectRatio: 1
			},
			function(){
		        // Use the API to get the real image size
		        var bounds = this.getBounds();
		        boundx = bounds[0];
		        boundy = bounds[1];
		        // Store the API in the jcrop_api variable
		        jcrop_api = this;
		    });
			function updateCoords(c) {
				$('#x').val(c.x);
				$('#y').val(c.y);
				$('#w').val(c.w);
				$('#h').val(c.h);
			};
			function checkCoords() {
				if (parseInt($('#w').val())) return true;
				alert('Please select a crop region then press submit.');
				return false;
			};
			function updatePreview(c) {
		        if (parseInt(c.w) > 0) {
					var rx = 48 / c.w;		//小头像预览Div的大小
					var ry = 48 / c.h;
					$('#preview').css({
						width: Math.round(rx * boundx) + 'px',
			            height: Math.round(ry * boundy) + 'px',
			            marginLeft: '-' + Math.round(rx * c.x) + 'px',
			            marginTop: '-' + Math.round(ry * c.y) + 'px'
					});
					
					var rx = 199 / c.w;		//大头像预览Div的大小
					var ry = 199 / c.h;
					$('#preview2').css({
			            width: Math.round(rx * boundx) + 'px',
			            height: Math.round(ry * boundy) + 'px',
			            marginLeft: '-' + Math.round(rx * c.x) + 'px',
			            marginTop: '-' + Math.round(ry * c.y) + 'px'
					});
		        }
			};
		});
		<?php endif;?>
		<?php endif;?>
	
		//搜索框
		$(".search").click(function(e) {
			e.preventDefault();
			$("fieldset#search_menu").toggle();
			$(".search").toggleClass("menu-open");
		});
	
		$("fieldset#search_menu").mouseup(function() {
			return false;
		});
		$(document).mouseup(function(e) {
			if($(e.target).parent("a.search").length==0) {
				$(".search").removeClass("menu-open");
				$("fieldset#search_menu").hide();
			}
		});
		$('#advanced_search_link').tipsy({gravity: 'w'});
	});
	</script>
<?php endif;?>